#include <iostream>
#include <future>
#include <memory>

int add(int a, int b) {
    return a + b;
}

int main() {
    auto task = std::make_shared<std::packaged_task<int(int, int)>>(add);
    std::future<int> result = task->get_future();
    std::thread t([task]() {
        (*task)(2, 3); 
    });
    std::cout << "结果是: " << result.get() << std::endl;
    t.join();
    return 0;
}